#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#define ARR_SIZE(arr) (sizeof(arr) / sizeof(arr[0]))
#define ERROR_CHECK(ret, error_flag, msg) \
    do { \
        if ((ret) == (error_flag)) { \
            printf("error: %s\n", msg); \
            exit(1); \
        } \
    } while(0)



//@file   : null
//@author : Chizuru
//@date   : 2024/4/1
//@brief  : null










void copy_file(const char* src_file, const char* dest_file) {
    FILE *fp_src = fopen(src_file, "r");
    ERROR_CHECK(fp_src, NULL, "open error");

    FILE* fp_dest = fopen(dest_file, "w");
    if (fp_dest == NULL) {
        fclose(fp_src);
        printf("error: %s\n", "openerror");
        exit(1);
    }

    int ch;
    while((ch = fgetc(fp_src)) != EOF){
        fputc(ch, fp_dest);
    }

    fclose(fp_src);
    fclose(fp_dest);
}


int main(void) {
    copy_file("8610wifi.log", "1.txt");

    return 0;
}